package main

import "fmt"

func reverse(s []int) {
}

var _ func([]int) = reverse

func main() {
	for _, t := range []struct {
		in, want []int
	}{
		{[]int{1, 2, 3, 4}, []int{4, 3, 2, 1}},
		{[]int{1, 2, 3, 4, 5}, []int{5, 4, 3, 2, 1}},
		{[]int{42}, []int{42}},
		{[]int{}, []int{}},
	} {
		in := make([]int, len(t.in))
		copy(in, t.in)
		reverse(in)
		if !sliceEqual(in, t.want) {
			fmt.Printf("reverse(%v) produced %v, want %v\n", t.in, in, t.want)
			fmt.Println("Oh no!")
			return
		}
	}
	fmt.Println("PASS")
}

func sliceEqual(a, b []int) bool {
	if len(a) != len(b) {
		return false
	}
	for i := range a {
		if a[i] != b[i] {
			return false
		}
	}
	return true
}

/*
func reverse(s []int) {
	l := len(s)
	for i := 0; i < l/2; i++ {
		j := l - 1 - i
		s[i], s[j] = s[j], s[i]
	}
}
*/
